//! \file map_utils.h

//------------------------------------------------------------------------------

#ifndef _MAP_UTILS_H_
#define _MAP_UTILS_H_

//------------------------------------------------------------------------------

#include "defs.h"

//------------------------------------------------------------------------------

typedef struct {
    addr_t addr_;
    unsigned int name_idx_;
} func_map_info;

typedef struct {
    func_map_info *map_;
    name_t *names_; 
    unsigned int size_; //! size of memory_map array
} func_map;

//! \brief Find the nearest less procedure with so address
//! \return Index of found result in memory_map or -1 if nothing found
int _FindByAddr(func_map *pmap, addr_t proc_addr);

void SortFuncMap(func_map *pmap); 

//! \brief Merge two func_maps. Don't forget do FREE MEMORY, allocated in
//  fm_res->map_ to store the union of func_map's
TBGError MergeFuncMaps(func_map *fm1, func_map *fm2, func_map *fm_res);

TBGError JoinToFuncMap(func_map *base_fm, func_map *join_fm);

//------------------------------------------------------------------------------

#endif //_MAP_UTILS_H
